import {
    list,
    saveElevator,
    getElevatorById,
    enabledControl
} from '@/services/elevator/elevatorService';

export default {
    namespace: 'elevatorModel',

    state: {},

    effects: {
        *list({payload, callback}, {call, put}) {
            const response = yield call(list, payload);
            if (callback) callback(response);
        },
        *saveElevator({payload, callback}, {call, put}) {
            const response = yield call(saveElevator, payload);
            if (callback) callback(response);
        },
        *getElevatorById({payload, callback}, {call, put}) {
            const response = yield call(getElevatorById, payload);
            if (callback) callback(response);
        },
        *enabledControl({ payload, callback }, { call, put }) {
            const response = yield call(enabledControl, payload);
            if(callback) callback(response);
        }
    },

    reducers: {},
};
